{literal}
<script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete the photo album. Continue?"))
document.location = "admin.php?page=photo&action=delete&id=" + articleId;
}

function deletephoto(photoid, albumid) {
if (confirm("This will remove the photo from the album. Continue?"))
document.location = "admin.php?page=photo&action=deletephoto&pid=" + photoid + "&id=" + albumid;
}

function viewphoto(what)
{
{/literal}
	var url = "{$photopath}" + what;
	window.open(url, 'ViewPhoto', 'HEIGHT=400,resizable=yes,WIDTH=400');
{literal}
}

function editphoto(what, aid)
{
	var url = "admin.php?page=photo_edit&ex=nomenu&pid=" + what + "&id="+aid;
	window.open(url, 'EditPhoto', 'HEIGHT=480,resizable=yes,WIDTH=500');
}

function confirmPublishart(articleId)
{
    if (confirm("This will publish the album. Continue?"))
    {
       if (confirm("Do you wish to publish all photos under the album as well?"))
       {
        {/literal}
        document.location = "{$pagename}&action=publishart&photo=yes&id=" + articleId;{literal}
       }
       else
       {
        {/literal}
        document.location = "{$pagename}&action=publishart&photo=no&id=" + articleId;{literal}
       }
    }
}

function confirmunPublishart(articleId)
{
    if (confirm("This will unpublish the album. Continue?")){/literal}
    document.location = "{$pagename}&action=unpublishart&id=" + articleId;{literal}
}

function confirmPublishphoto(articleId, al)
{
    if (confirm("This will publish the photo. Continue?")){/literal}
    document.location = "{$pagename}&action=publishphoto&pid=" + articleId + "&id=" + al;{literal}
}

function confirmunPublishphoto(articleId, al)
{
    if (confirm("This will unpublish the photo. Continue?")){/literal}
    document.location = "{$pagename}&action=unpublishphoto&pid=" + articleId + "&id=" + al;{literal}
}
//-->
</script>
{/literal}
{if $action != 'view'}
{if $numalbums > 0}
<h2>Photo Albums</h2>
	<table width="100%" border="0" cellpadding="4" cellspacing="1" class="table">
	  <tr>
		<th width="10%" class="smallhead">Action</th>
        <th width="5%" class="smallhead">Published</th>
		<th class="smallhead">Name of Album</th>
		<th width="5%" class="smallhead">Patrol</th>
	  </tr> 
	 {section name=albumloop loop=$numalbums}
		 <tr>
			<td class="text"><a href="{$pagename}&amp;action=view&amp;id={$albums[albumloop].ID}"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="View Photos for {$albums[albumloop].album_name}" title="View Photos for {$albums[albumloop].album_name}" /></a> - <a href="javascript:confirmDelete({$albums[albumloop].ID})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$albums[albumloop].album_name}" title="Delete {$albums[albumloop].album_name}" /></a></td>
            <td class="text">{if $albums[albumloop].allowed == 0}<a href="javascript:confirmPublishart({$albums[albumloop].ID})"><img src="{$tempdir}admin/images/publish.png" border="0" alt="Publish" title="Publish" /></a>{else}<a href="javascript:confirmunPublishart({$albums[albumloop].ID})"><img src="{$tempdir}admin/images/unpublish.png" border="0" alt="Unpublish" title="Unpublish" /></a>{/if}</td>
			<td class="text">{$albums[albumloop].album_name}</td>
			<td class="text">{$albums[albumloop].patrol}</td>
	  </tr>
	  {/section}
	</table>
    {else}
<div align="center">No photo albums</div>
{/if}
{else}
	<h1>{$albuminfo.album_name}</h1>
	Owner: {$albuminfo.owner}<br />
	Number of photos: {$numphotos}
    {if $numphotos > 0}
    <h2>Photos</h2>
	<table width="100%" border="0" cellpadding="4" cellspacing="1" class="table">
	  <tr>
		<th width="13%" class="smallhead">Action</th>
        <th class="smallhead">Published</th>
		<th width="11%" class="smallhead">Photo</th>
		<th width="76%" class="smallhead">Caption</th>
	  </tr> 
	 {section name=photoloop loop=$numphotos}
		 <tr>
			<td height="90" class="text"><a href="javascript:viewphoto('{$photos[photoloop].filename}')"><img src="{$tempdir}admin/images/mod.gif" border="0" alt="View {$photos[photoloop].caption}" title="View {$photos[photoloop].caption}" /></a> - <a href="javascript:editphoto('{$photos[photoloop].ID}','{$albuminfo.ID}')"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$photos[photoloop].caption}" title="Edit {$photos[photoloop].caption}" /></a> - <a href="javascript:deletephoto({$photos[photoloop].ID},{$albuminfo.ID})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$photos[photoloop].caption}" title="Delete {$photos[photoloop].caption}" /></a></td>
            <td class="text">{if $photos[photoloop].allowed == 0}<a href="javascript:confirmPublishphoto({$photos[photoloop].ID},{$albuminfo.ID})"><img src="{$tempdir}admin/images/publish.png" border="0" alt="Publish" title="Publish" /></a>{else}<a href="javascript:confirmunPublishphoto({$photos[photoloop].ID},{$albuminfo.ID})"><img src="{$tempdir}admin/images/unpublish.png" border="0" alt="Unpublish" title="Unpublish" /></a>{/if}</td>
			<td class="text"><img src="thumbnail.php?pic={$photos[photoloop].ID}" alt="{$photos[photoloop].caption}" /></td>
			<td class="text">{$photos[photoloop].caption}</td>
	  </tr>
	  {/section}
	</table>
    {else}
<div align="center">No photos in {$albuminfo.album_name}</div>
{/if}
<div align="center"><input type="button" class="button" value="Back" onclick="window.location='{$pagename}'" /></div>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-photoalbums" target="_blank">Help</a>
</div>